package com.xiaomei.manager.utils;


public class OrderPriceUtil {
		
	private static final Double UNIT_PRICE = 2.0; //小数的默认类型为double
	private static final Double BASE_KILOMETRE = 2.5; //基准公里（km）
	
	/**
	 * 计算消费的价格
	 * @param kilometreNo(km)
	 * @return
	 */
	public static double computeOrderPrice(double kilometreNo){
		
		/*if(kilometreNo > BASE_KILOMETRE)
			return NumberUtil.round(NumberUtil.mul(kilometreNo, UNIT_PRICE));
		else{
			return 5.00;
		}*/
		if(kilometreNo>500.00){
			return NumberUtil.round(NumberUtil.mul(kilometreNo, 0.50));

		}else if (kilometreNo>30.00 && kilometreNo< 500.00){
			return NumberUtil.round(NumberUtil.mul(kilometreNo, 0.67));

		}else if (kilometreNo>10.00 && kilometreNo<30.00){
			return NumberUtil.round(NumberUtil.mul(kilometreNo, 1.00));

		}else if (kilometreNo>3.00 && kilometreNo<10.00) {
			return NumberUtil.round ( NumberUtil.mul ( kilometreNo, 1.30 ) );

		}
		return 5.00;
	}

}
